﻿using FadeLang.Ast;
using FadeLang.Runtime;

namespace FadeLang.CstVisitor
{
    public class FunctionCallVisitor : FadeLangBaseVisitor<FunctionCall>
    {
        private readonly Context context;

        public FunctionCallVisitor(Context context) {
            this.context = context;
        }


        public override FunctionCall VisitFunctionCall(FadeLangParser.FunctionCallContext context) {
            var cc = new FunctionCall {
                Name = context.NAME()?.GetText(),
                ArgList = context.argList().Accept(new ArgListVisitor(this.context))
            };
            return cc;
        }
    }
}